﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EntitiesLayer;
using System.Collections;
using System.Transactions;
using System.Data.SqlClient;
using System.Data;
using DAL.Repositories;
using DAL;

namespace DAL.Repositories
{
    public class PreciosRepository : IRepository<TiposPagos>
    {
        private List<TiposPagos> _insertItems { get; set; }
        private List<TiposPagos> _updateItems { get; set; }


       public PreciosRepository()
       {
           _insertItems = new List<TiposPagos>();
           _updateItems = new List<TiposPagos>();
       }

       public void Insert(TiposPagos entity)
       {
            throw new NotImplementedException();
        }

        public void Delete(TiposPagos entity)
        {
            throw new NotImplementedException();
        }

         public void Update(TiposPagos entity)
         {
            throw new NotImplementedException();
         }

        public IEnumerable<TiposPagos> GetAll()
         {
            return null;
         }

        public TiposPagos GetById(int pid)
        {

            TiposPagos precio = null;
            try
            {
                SqlCommand sql = new SqlCommand();
                sql.Parameters.Add(new SqlParameter("@idTipoPago", pid));
                DataSet ds = DBAccess.ExecuteSPWithDS(ref sql, "pa_tipo_pago");

                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        precio = new TiposPagos()
                        {
                            Id = Convert.ToInt16(dr["id"]),
                            Nombre = dr["nombre"].ToString(),
                            Valor = Convert.ToDouble(dr["valor"])
                        };
                    }
                }
            }
            catch (Exception)
            {
                //viva la excepcion
            }
            return precio;
        }


        public void Save()
        {
            throw new NotImplementedException();
        }

        public void Clear()
        {
             throw new NotImplementedException();
        }

        public IEnumerable<TiposPagos> GetUsuarios(int ptipo)
         {
            throw new NotImplementedException();
         }
        private void InsertMusculo(TiposPagos objMusculo)
        {
        }

        private void UpdateMusculo(TiposPagos objMusculo)
        {

        }
    }
 }
